/*************************************************************************
> File Name: main.cpp
> Author: hzy
> Created Time: 2023-08-10 17:31:28
> Description: 练习：构造一个复数类，数据成员包含复数的实部和虚部。
成员函数：
复数的输出;
add、sub、mul、div成员函数，实现复数的+ - * / 功能；
全局函数：add、sub、mul、div
************************************************************************/
#include "class_complex.h"

int main()
{
    Complex c1(1, 5);
    Complex c2(-1, -2);

    // 成员方法
    Complex add = c1.Add(c2);
    Complex sub = c1.Sub(c2);
    Complex mul = c1.Mul(c2);
    Complex div = c1.Div(c2);
    // 全局方法
    Complex adds(Adds(c1, c2));
    Complex subs = Subs(c1, c2);

    cout << "c1: ";
    c1.Show();
    cout << "c2: ";
    c2.Show();

    cout << "成员方法" << endl;
    cout << "Add(加法): ";
    add.Show();
    cout << "Sub(减法): ";
    sub.Show();
    cout << "Mul(乘法): ";
    mul.Show();
    cout << "Div(除法): ";
    div.Show();

    cout << "全局方法" << endl;
    cout << "Adds(加法): ";
    Adds(c1, c2);
    adds.Show();
    cout << "Subs(减法): ";
    subs.Show();

    return 0;
}